<?php
// Tim'Roster
// Copyright (c) 2011 Nicolas Nallet <aspgic2@gmail.com>
//
// This file is part of Tim'Roster.
//
// Tim'Roster is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Tim'Roster is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA



$xml_config = simplexml_load_file('config.xml');

include_once($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/data_access/error_log_DA.php');


class Error_Log{

    const GUILD_ENTITY_TYPE = 0;
    const CHARACTER_ENTITY_TYPE = 1;

    const API_DATA_EXTRACT_ERROR_ID = 0;


    /**
     * (PHP 5)<br/>
     * Get error list
     * @param datetime $min_date_error
     * @return array of Error_Log
     */
    public static function get_error_list($min_date_error){
        $da = new error_log_DA();
        return $da->get_error_list($min_date_error);
    }

    /**
     * (PHP 5)<br/>
     * Save the error in DB
     */
    public function save_error_log(){
        $da = new error_log_DA();
        $da->insert_error_log($this);
    }

    /**
     * (PHP 5)<br/>
     * Construct a Error_Log instance
     * @param int $id
     * @param int $error_type
     * @param datetime $creation_date
     * @param int $entity_id
     * @param string $entity_name
     * @param string $entity_api_key
     * @param int $entity_type
     */
    public function Error_Log($id, $error_type, $creation_date, $entity_id, $entity_name, $entity_api_key,  $entity_type){
        $this->id = $id;
        $this->error_type = $error_type;
        $this->creation_date = $creation_date;
        $this->entity_id = $entity_id;
        $this->entity_name = $entity_name;
        $this->entity_api_key = $entity_api_key;
        $this->entity_type = $entity_type;
    }

    private $id;
    /**
     * (PHP 5)<br/>
     * Get the error id
     * @return int
     */
    public function get_id(){
        return $this->id;
    }

    private $error_type;
    /**
     * (PHP 5)<br/>
     * Get the error type
     * @return int
     */
    public function get_error_type(){
        return $this->error_type;
    }

    private $creation_date;
    /**
     * (PHP 5)<br/>
     * Get the error creation date
     * @return datetime
     */
    public function get_creation_date(){
        return $this->creation_date;
    }

    private $entity_id;
    /**
     * (PHP 5)<br/>
     * Get the error entity id
     * @return int
     */
    public function get_entity_id(){
        return $this->entity_id;
    }

    private $entity_name;
    /**
     * (PHP 5)<br/>
     * Get the error entity name
     * @return string
     */
    public function get_entity_name(){
        return $this->entity_name;
    }

    private $entity_api_key;
    /**
     * (PHP 5)<br/>
     * Get the error entity api key
     * @return string
     */
    public function get_entity_api_key(){
        return $this->entity_api_key;
    }

    private $entity_type;
    /**
     * (PHP 5)<br/>
     * Get the error entity type (Error_Log::CHARACTER_ENTITY_TYPE, Error_Log::GUILD_ENTITY_TYPE)
     * @return int
     */
    public function get_entity_type(){
        return $this->entity_type;
    }

}


?>
